package ua.yandex.skipass;

/**
 * пропуск на количество поездок
 *
 * @author WslF
 */
public class PassTimes extends Pass {

    private int numberOfLifts;

    public PassTimes(TypeOfPasses type) {
        super(type);
        switch (type) {
            case TenTimes:
            case HolidayTenTimes:
                numberOfLifts = 2 * 2 * 2 + 2;
                break;
            case TwentyTimes:
            case HolidayTwentyTimes:
                numberOfLifts = 2 * (2 * 2 * 2 + 2);
                break;
            case FiftyTimes:
            case HolidayFiftyTimes:
                numberOfLifts = 2 * (2 * (2 * 2 * 2 + 2)) + 2 * 2 * 2 + 2;
                break;
            case HundredTimes:
            case HolidayHundredTimes:
                numberOfLifts = 2 * (2 * (2 * (2 * 2 * 2 + 2)) + 2 * 2 * 2 + 2);
                break;

            default:
                numberOfLifts = 0;
        }

    }

    @Override
    protected boolean couldUse() {
        return numberOfLifts > 0;
    }

    public void use() {
        numberOfLifts--;
    }

}
